home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WDEF.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  11.0 KB  |  393 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1995 by Watcom International Corp.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of Watcom International Corp.
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WDEF_HPP_INCLUDED
  12. #define _WDEF_HPP_INCLUDED
  13. #pragma once
  14.  
  15. #ifndef _WNO_PRAGMA_PUSH
  16. #pragma pack(push,8);
  17. #pragma enum int;
  18. #endif
  19.  
  20. // Include basic stuff...
  21.  
  22. #ifndef _WDECL_HPP_INCLUDED
  23. #include "wdecl.hpp"
  24. #endif
  25.  
  26. //
  27. // Get rid of conflicts...
  28. //
  29.  
  30. #ifndef _WIN16
  31. #undef FindWindow
  32. #undef FindWindowEx
  33. #undef SendMessage
  34. #undef GetClassName
  35. #if defined( _UNICODE )
  36.     #define FindWindow  FindWindowW
  37.     #define FindWindowEx FindWindowExW
  38.     #define SendMessage SendMessageW
  39.     #define GetClassName    GetClassNameW
  40. #else
  41.     #define FindWindow  FindWindowA
  42.     #define FindWindowEx FindWindowExA
  43.     #define SendMessage SendMessageA
  44.     #define GetClassName    GetClassNameA
  45. #endif
  46. #endif
  47.  
  48. //
  49. // Forward declarations for classes
  50. //
  51.  
  52. class WObject;
  53. class WScrollBar;
  54.  
  55. class WMessage;
  56. class WWindow;
  57. struct WInstance;
  58.  
  59. //
  60. // General type definitions
  61. //
  62.  
  63. #define LAST_32BIT      0xFFFFFFFF
  64. #define LAST_16BIT      0xFFFF
  65.  
  66. #ifndef _INC_WINDOWS
  67. #define FAR                 __far
  68. #define NEAR                __near
  69. typedef char FAR*           LPSTR;
  70. typedef const char FAR*     LPCSTR;
  71. #endif
  72. #ifdef _WIN16
  73. #define LAST_16TO32BIT  0xFFFF
  74. #ifndef _COMPOBJ_H_
  75. typedef int                 INT;
  76. typedef unsigned int        UINT;
  77. typedef unsigned int        *PUINT;
  78. typedef unsigned char       UCHAR;
  79. typedef UCHAR               *PUCHAR;
  80. typedef unsigned long       ULONG;
  81. typedef ULONG               *PULONG;
  82. typedef unsigned short      USHORT;
  83. typedef short               SHORT;
  84. typedef unsigned long       DWORD;
  85. #endif
  86. typedef LPSTR               LPTSTR;
  87. typedef LPCSTR              LPCTSTR;
  88. #else
  89. #define LAST_16TO32BIT  0xFFFFFFFF
  90. #endif
  91.  
  92. #if defined( _WIN16 ) && defined( _INC_WINDOWS )
  93. #define _WINDEF_
  94. #endif
  95.  
  96. typedef unsigned long WDialogID;
  97. typedef unsigned long WNotifyInfo;
  98.  
  99. #ifdef _WINDEF_
  100. #ifndef STRICT
  101. #error If you wish to include windows.h, you must add the line 'define STRICT' first
  102. #endif
  103. #endif
  104. #ifndef _WINDEF_
  105. #ifndef _WIN16
  106. typedef void *          HANDLE;
  107. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
  108. #else
  109. typedef const void NEAR*        HANDLE;
  110. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef const struct name##__ NEAR* name
  111. #endif
  112. DECLARE_HANDLE(         HWND );
  113. DECLARE_HANDLE(         HMENU );
  114. DECLARE_HANDLE(         HDC );
  115. DECLARE_HANDLE(         HBITMAP );
  116. DECLARE_HANDLE(         HICON );
  117. typedef HICON           HCURSOR;
  118. DECLARE_HANDLE(         HBRUSH );
  119. DECLARE_HANDLE(         HPEN );
  120. DECLARE_HANDLE(         HFONT );
  121. DECLARE_HANDLE(         HMETAFILE );
  122. DECLARE_HANDLE(         HINSTANCE );
  123. typedef HANDLE          HGLOBAL;
  124. typedef WDWord          HIMC;
  125. #ifndef _WIN16
  126. DECLARE_HANDLE(         HKL );
  127. #endif
  128. typedef HINSTANCE       HMODULE;
  129. #ifndef _WIN16
  130. typedef HANDLE          HDWP;
  131. #else
  132. DECLARE_HANDLE(         HDWP );
  133. #endif
  134. #endif
  135. #ifndef _INC_COMMCTRL
  136. #ifndef _WIN16
  137. struct _IMAGELIST;
  138. typedef struct _IMAGELIST near * HIMAGELIST;
  139. #else
  140. struct _PBIMAGELIST;
  141. typedef struct _PBIMAGELIST far * HIMAGELIST;
  142. #endif
  143. #endif
  144.  
  145. typedef HDWP            WDeferMoveHandle;
  146. #define NULLHDWP        (WDeferMoveHandle)0
  147. #define LASTHDWP        (WDeferMoveHandle)LAST_16TO32BIT
  148.  
  149. typedef HWND            WWindowHandle;
  150. #define NULLHWND        (WWindowHandle)0
  151. #define LASTHWND        (WWindowHandle)LAST_16TO32BIT
  152.  
  153. typedef HMENU           WMenuHandle;
  154. #define NULLHMNU        (WMenuHandle)0
  155. #define LASTHMNU        (WMenuHandle)LAST_16TO32BIT
  156.  
  157. typedef HDC             WDeviceHandle;
  158. #define NULLHDEV        (WDeviceHandle)0
  159. #define LASTHDEV        (WDeviceHandle)LAST_16TO32BIT
  160.  
  161. typedef HBITMAP         WBitmapHandle;
  162. #define NULLHBMP        (WBitmapHandle)0
  163. #define LASTHBMP        (WBitmapHandle)LAST_16TO32BIT
  164.  
  165. typedef HICON           WIconHandle;
  166. #define NULLHICON       (WIconHandle)0
  167. #define LASTHICON       (WIconHandle)LAST_16TO32BIT
  168.  
  169. typedef HCURSOR         WCursorHandle;
  170. #define NULLHCURSOR     (WCursorHandle)0
  171. #define LASTHCURSOR     (WCursorHandle)LAST_16TO32BIT
  172.  
  173. typedef HBRUSH          WBrushHandle;
  174. #define NULLHBRUSH      (WBrushHandle)0
  175. #define LASTHBRUSH      (WBrushHandle)LAST_16TO32BIT
  176.  
  177. typedef HPEN            WPenHandle;
  178. #define NULLHPEN        (WPenHandle)0
  179. #define LASTHPEN        (WPenHandle)LAST_16TO32BIT
  180.  
  181. typedef HFONT           WFontHandle;
  182. #define NULLHFONT       (WFontHandle)0
  183. #define LASTHFONT       (WFontHandle)LAST_16TO32BIT
  184.  
  185. typedef HMETAFILE       WMetafileHandle;
  186. #define NULLHMF         (WMetafileHandle)0
  187. #define LASTHMF         (WMetafileHandle)LAST_16TO32BIT
  188.  
  189. typedef HMODULE         WModuleHandle;
  190. #define NULLHMODULE     (WModuleHandle)0
  191. #define LASTHMODULE     (WModuleHandle)LAST_16TO32BIT
  192.  
  193. typedef HGLOBAL         WMemoryHandle;
  194. #define NULLHMEM        (WMemoryHandle)0
  195. #define LASTHMEM        (WMemoryHandle)LAST_16TO32BIT
  196.  
  197. typedef HKL             WKeyboardHandle;
  198. #define NULLHKL         (WKeyboardHandle)0
  199. #define LASTHKL         (WKeyboardHandle)LAST_16TO32BIT
  200.  
  201. typedef HIMC            WInputContextHandle;
  202. #define NULLHIMC        (WInputContextHandle)0;
  203. #define LASTHIME        (WInputContextHanlde)LAST_16TO32BIT
  204.  
  205. typedef HIMAGELIST      WImageListHandle;
  206. #define NULLHIMAGELIST  (WImageListHandle)0
  207. #define LASTHIMAGELIST  (WImageListHandle)LAST_16TO32BIT
  208.  
  209. enum WNotify          { NULLNOTIFY     = 0,  LASTNOTIFY = LAST_16BIT };
  210. enum WCallbackProc    { NULLCALLBACK   = 0,  LASTCALLBACK = LAST_32BIT };
  211.  
  212. #ifndef CALLBACK
  213. #if defined( __NT__ )
  214. #define CALLBACK __stdcall
  215. #else
  216. #define CALLBACK __far __pascal
  217. #endif
  218. #endif
  219. #ifndef WINAPI
  220. #if defined( __NT__ )
  221. #define WINAPI __stdcall
  222. #else
  223. #define WINAPI __far __pascal
  224. #endif
  225. #endif
  226.  
  227. //
  228. // _ApplicationModule
  229. //
  230. //    This global variable must be defined by any program that uses
  231. //    classes that require resources.
  232.  
  233. extern WModuleHandle _ApplicationModule;
  234.  
  235.  
  236. typedef struct WInstance * WINSTANCE;
  237.  
  238. class WWindow;
  239.  
  240. class WCMCLASS WRange {
  241.  
  242.     public:
  243.  
  244.         /***************************************************************
  245.          * Constructors and Destructors
  246.          ***************************************************************/
  247.  
  248.         WRange();
  249.         WRange( WInt s, WInt e );
  250.         WRange( const WRange & r );
  251.  
  252.         ~WRange();
  253.  
  254.         /***************************************************************
  255.          * Properties
  256.          ***************************************************************/
  257.  
  258.         WInt GetDistance() const;
  259.  
  260.         /***************************************************************
  261.          * Methods
  262.          ***************************************************************/
  263.  
  264.         WBool AboveRange( WInt i ) const;
  265.  
  266.         WBool BelowRange( WInt i ) const;
  267.  
  268.         WBool InsideRange( WInt i ) const;
  269.  
  270.         /***************************************************************
  271.          * Data Members
  272.          ***************************************************************/
  273.  
  274.         WInt start;
  275.         WInt end;
  276. };
  277.  
  278. enum WStyle       { NULLWSTYLE =    0,  LASTWSTYLE = LAST_32BIT };
  279.  
  280. inline WStyle operator|( WStyle lhs, WStyle rhs )
  281.     { return (WStyle)((unsigned long)lhs | (unsigned long)rhs); }
  282.  
  283. inline WStyle operator&( WStyle lhs, WStyle rhs )
  284.     { return (WStyle)((unsigned long)lhs & (unsigned long)rhs); }
  285.  
  286. inline WStyle operator~( WStyle style )
  287.     { return (WStyle)(~(unsigned long)style); }
  288.  
  289. inline WStyle & operator|=( WStyle & lhs, WStyle rhs )
  290.     { lhs = (WStyle)((unsigned long)lhs | (unsigned long)rhs); return lhs; }
  291.  
  292. inline WStyle & operator&=( WStyle & lhs, WStyle rhs )
  293.     { lhs = (WStyle)((unsigned long)lhs & (unsigned long)rhs); return lhs; }
  294.  
  295. #ifndef _WCHAR_HPP_INCLUDED
  296. #  include "wchar.hpp"
  297. #endif
  298. #ifndef _WBASECL_HPP_INCLUDED
  299. #  include "wbasecl.hpp"
  300. #endif
  301. #ifndef _WMEMORY_HPP_INCLUDED
  302. #  include "wmemory.hpp"
  303. #endif
  304. #ifndef _WDEBUG_HPP_INCLUDED
  305. #  include "wdebug.hpp"
  306. #endif
  307.  
  308. inline long WMin( long a, long b ) { return (a<b) ? a  : b; }
  309. inline long WMax( long a, long b ) { return (a>b) ? a  : b; }
  310. inline long WAbs( long a )      { return (a<0) ? -a : a; }
  311.  
  312. extern unsigned long WProcessID;
  313. extern WBool WDraggingMode;
  314.  
  315. enum WShowStyle {
  316.     WWinStateHide               = 0,
  317.     WWinStateShowNormal         = 1,
  318.     WWinStateNormal             = WWinStateShowNormal,
  319.     WWinStateMinimized          = 2,
  320.     WWinStateShowMinimized      = WWinStateMinimized,
  321.     WWinStateMaximized          = 3,
  322.     WWinStateShowMaximized      = WWinStateMaximized,
  323.     WWinStateMaximize           = WWinStateMaximized,
  324.     WWinStateShowNoActivate     = 4,
  325.     WWinStateShow               = 5,
  326.     WWinStateMinimize           = 6,
  327.     WWinStateShowMinNoActivate  = 7,
  328.     WWinStateShowNA             = 8,
  329.     WWinStateShowRestore        = 9,
  330.     WWinStateShowDefault        = 10,
  331.     WWinStateMax                = WWinStateShowDefault
  332. };
  333.  
  334. // ------ Scrollbar Definitions ------- //
  335.  
  336. enum WScrollMessage {
  337.     WLineUp                     = 0,
  338.     WLineLeft                   = WLineUp,
  339.     WLineDown                   = 1,
  340.     WLineRight                  = WLineDown,
  341.     WPageUp                     = 2,
  342.     WPageLeft                   = WPageUp,
  343.     WPageDown                   = 3,
  344.     WPageRight                  = WPageDown,
  345.     WPosition                   = 4,
  346.     WTrack                      = 5,
  347.     WTop                        = 6,
  348.     WLeft                       = WTop,
  349.     WBottom                     = 7,
  350.     WRight                      = WBottom,
  351.     WEndScroll                  = 8,
  352. };
  353.  
  354. enum WScrollDir {
  355.     WScrollHorizontal           = 0,
  356.     WScrollVertical             = 1,
  357. };
  358.  
  359. enum WMouseFlagValues {
  360.     WMKNone         = 0x0000,
  361.     WMKLeftDown     = 0x0001,
  362.     WMKLeftButton   = WMKLeftDown,
  363.     WMKRightDown    = 0x0002,
  364.     WMKRightButton  = WMKRightDown,
  365.     WMKShift        = 0x0004,
  366.     WMKControl      = 0x0008,
  367.     WMKMiddleDown   = 0x0010,
  368.     WMKMiddleButton = WMKMiddleDown,
  369.     WMKAlt          = 0x0020
  370. };
  371. typedef WULong WMouseFlags;
  372.  
  373. #define WClass_SendMessage(type,msg,wp,lp) \
  374.                      (type)SendMessage(WMessage(msg,wp,lp))
  375.  
  376. #define inline_win32 inline
  377. #define inline_win   inline
  378. #define inline_win16
  379. #define inline_os2
  380.  
  381. #if defined( DECLARE_HANDLE )
  382.     typedef HWND _WHWND;
  383. #else
  384.     typedef void *_WHWND;
  385. #endif
  386.  
  387. #ifndef _WNO_PRAGMA_PUSH
  388. #pragma enum pop;
  389. #pragma pack(pop);
  390. #endif
  391.  
  392. #endif // _WDEF_HPP_INCLUDED
  393.